package com.candy.inner;

import org.w3c.dom.ls.LSOutput;

public class Student {
    //属性
    private int stuId;
    private String stuName;
    private boolean stuSex;

    //成员内部类
    class Game{
        void doSomething(){
            System.out.println("我是成员内部类");
        }
    }

    public Student() {
    }

    public Student(int stuId, String stuName, boolean stuSex) {
        this.stuId = stuId;
        this.stuName = stuName;
        this.stuSex = stuSex;
    }

    //方法
    public void studing(){
        System.out.println("我在学习");
        Game g=new Game();
        g.doSomething();
    }

    public  void eatting(){
        //局部内部类
        class Sleep{
            void someThing(){
                System.out.println("我是局部内部类");
            }
        }
        System.out.println("我在吃饭");
        Sleep s1=new Sleep();
        s1.someThing();
    }

    public int getStuId() {
        return stuId;
    }

    public void setStuId(int stuId) {
        this.stuId = stuId;
    }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public boolean isStuSex() {
        return stuSex;
    }

    public void setStuSex(boolean stuSex) {
        this.stuSex = stuSex;
    }

//    @Override
//    public String toString() {
//        return "Student{" +
//                "stuId=" + stuId +
//                ", stuName='" + stuName + '\'' +
//                ", stuSex=" + stuSex +
//                '}';
//    }

    public void sayHi(){
        System.out.println("大家好！");
        new Team(){
            @Override
            public void playGame() {
                System.out.println("我是匿名内部类");
            }
        }.playGame();
    }
}
